/******************************************************************
 *****                                                        *****
 *****  Name: easyweb.c                                       *****
 *****  Ver.: 1.0                                             *****
 *****  Date: 07/05/2001                                      *****
 *****  Auth: Andreas Dannenberg                              *****
 *****        HTWK Leipzig                                    *****
 *****        university of applied sciences                  *****
 *****        Germany                                         *****
 *****  Func: implements a dynamic HTTP-server by using       *****
 *****        the easyWEB-API                                 *****
 *****                                                        *****
 ******************************************************************/

//#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#define extern            // Keil: Line added for modular project management

#include "easyweb.h"

#include "EMAC.h"         // Keil: *.c -> *.h    // ethernet packet driver
#include "tcpip.h"        // Keil: *.c -> *.h    // easyWEB TCP/IP stack
#include <LPC23xx.h>      // Keil: Register definition file for LPC2378

#include "webpage.h"                             // webside for our HTTP server (HTML)


//void main(void)
int main(void)
{
unsigned char buf[60];
unsigned char mac,it;
unsigned int lenght;
FIO2DIR=0x0000000FF;
//buf[0]=0x10;buf[1]=0x20;buf[2]=0x30;buf[3]=0x40;
Init_EMAC();
lenght=0;
while(1)
{
lenght=StartReadFrame();
//if(lenght==60)
{
	FIO2CLR=0x0000000F;
	if(CheckFrameReceived()==1){
	CopyFromFrame_EMAC(buf,60);
	EndReadFrame();
	for(it=0;it<6;it++)
	{
		mac=buf[it];
		buf[it]=buf[it+6];
		buf[it+6]=mac;


	}
	RequestSend(60);
	CopyToFrame_EMAC(buf,60); }
}

lenght=0;
}
}
